﻿@model List<WebEntities.Models.Framework.UIMenuItem>

@{
    ViewBag.Title = "网站管理平台_用户菜单项管理视图";
}

@Html.X().Hidden().ID("DeleteHint").Text("是否要删除选中的用户菜单项？")

@(Html.X().Viewport()
    .Layout("fit")
    .Items(
        Html.X().GridPanel()
            .ID("GridPanel1")
            .Store(
                Html.X().StoreForModel()
                    .AutoSync(true)
                    .PageSize(50)
                    .ShowWarningOnFailure(false)
                    .Proxy(proxy => proxy.Add(Html.X().AjaxProxy()
                        .Url(Url.Action("GetAllMemberMuItem"))
                        .ExtraParams(ep =>
                        {
                            Parameter p1 = new Parameter
                            {
                                Name = "gid",
                                Value = ViewBag.GID,
                                Mode = ParameterMode.Value
                            };
                            ep.Add(p1);
                        })
                        .Reader(Html.X().JsonReader().Root("data"))
                        .Writer(writer => new JsonWriter { AllowSingle = true, Root = "data" })
                        .API(api => api.Destroy = Url.Action("DeleteMemberMuItem"))
                    ))
                    .Listeners(ls => ls.Write.Fn = "ext.net.comjs.onGridChange")
            )
            .ColumnModel(
                Html.X().RowNumbererColumn(),
                Html.X().Column().DataIndex(Model, m => m.ItemName).Text("菜单项名称"),
                Html.X().Column().DataIndex(Model, m => m.MenuName).Text("栏目菜单名称"),
                Html.X().Column().DataIndex(Model, m => m.SortNum).Text("序号")
            )
            .SelectionModel(Html.X().CheckboxSelectionModel().Mode(SelectionMode.Multi))
            .TopBar(
                Html.X().Toolbar()
                    .Items(
                        Html.X().Button().Text("新建用户菜单项").Icon(Icon.Add).DirectClickAction("NewMemMuItemWindow", new { gid = ViewBag.GID }),
                        Html.X().Button().ID("BtnDeleteSel").Text("删除用户菜单项").Icon(Icon.Cross)
                            .Listeners(
                                ls => ls.Click.Fn = "ext.net.comjs.deleteGridSelected"
                            )
                    )
            )
            .BottomBar(
                Html.X().PagingToolbar()
                    .Items(
                        Html.X().Label("每页显示行数："),
                        Html.X().ToolbarSpacer(10),
                        Html.X().ComboBox()
                            .Width(80)
                            .Items("10", "50", "100")
                            .SelectedItems("50")
                            .Listeners(lr =>
                            {
                                lr.Select.Fn = "ext.net.comjs.onPageSizeChange";
                            })
                    )
            )
    )
)